import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function(location) {
  return originalPush.call(this, location).catch(err => {})
};

Vue.use(VueRouter)

const routes = [
  {
path:'/',
redirect:'/home'
  },
  {
    path: '/home',
    name: 'home',
    component: Home,
    //添加子路由
    children: [
      {
        path: '/searchPopup',
        name: 'searchPopup',
        component: () => import('../views/searchPopup.vue')
      }
    ]
  },

]

const router = new VueRouter({
  // mode:'history',
  routes
})

export default router
